package com.service.single.service.impl;

import cn.hutool.core.io.file.FileReader;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.service.single.entity.FileInfo;
import com.service.single.service.FileParseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.io.BufferedInputStream;

/**
 * @Author: 一休
 * @DateTime: 2022/11/2 15:36
 */
@Slf4j
@Service
public class ExcelParseServiceImpl implements FileParseService {

    @Override
    public void fileParse(FileInfo fileInfo) {
        Integer fileType = fileInfo.getFileType();
        String filePath = fileInfo.getFilePath();
        if (fileType != 0) {
            return;
        }
        FileReader fileReader = new FileReader(filePath);
        BufferedInputStream inputStream = fileReader.getInputStream();
        ExcelReader excelReader = ExcelUtil.getReader(inputStream);

        log.info("处理Excel文件......");
    }
}
